<template>
  <div id="welfare">
    <NavTitle>
      <template #center>
        <div class="title">组织主要公益事项</div>
        <div class="info">RGANIZING PUBLIC WELFARE MATTERS</div>
      </template>
    </NavTitle>
    <div class="lists">
      <template v-for="item in state.mattersList" :key="item._id">
        <div class="list">
          <div class="cover">
            <img :src="item.cover" alt="" />
          </div>
          <div class="title">{{ item.title }}</div>
          <div class="des">
            {{ item.des }}
          </div>
          <div class="more">
            <a href="/welfare">MORE></a>
          </div>
        </div>
      </template>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive } from 'vue'
import { NavTitle } from '@/components/client/public'
import { getMattersInfo } from '@/server/client/home'
import type { MattersDataTypes } from '@/server/client/home'

const state = reactive({
  mattersList: [] as Array<MattersDataTypes>
})

// 获取组织主要公益事项
const { data: mattersList } = await getMattersInfo()
state.mattersList = mattersList.data.mattersList
</script>

<style scoped lang="less">
#welfare {
  width: 1200px;
  margin: 60px auto;
  .lists {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    .list {
      width: 371px;
      height: 425px;
      position: relative;
      transition: all 0.35s;
      top: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      box-sizing: border-box;
      padding-top: 15px;
      justify-content: space-between;
      &:hover {
        box-shadow: 0 0 13px rgb(215, 210, 210);
        top: -10px;
        .title {
          color: #f13a3a;
        }
        img {
          transform: scale(1.1);
        }
      }
      .cover {
        width: 348px;
        height: 200px;
        overflow: hidden;
        margin-bottom: 20px;
        img {
          width: 100%;
          height: 100%;
          transition: all 0.35s;
        }
      }
      .title {
        width: 320px;
        height: 40px;
        text-align: left;
        color: #444444;
        line-height: 40px;
        margin-bottom: 5px;
      }
      .des {
        width: 320px;
        height: 40px;
        font-size: 14px;
        color: #777777;
        line-height: 2em;
        flex: 1;
      }
      .more {
        height: 60px;
        width: 330px;
        border-top: 1px solid #efecec;
        line-height: 60px;
        font-size: 12px;
        color: #777777;
        margin-top: 20px;
        text-indent: 10px;
        a {
          color: #777777;
        }
      }
    }
  }
}
</style>
